<ion-view view-title="客户信息" ng-controller="ClientEditController">
  <ion-content>
    <div class="content has-header">
      <form name="dataForm" novalidate="novalidate" ng-submit="formsubmit(dataForm.$dirty, dataForm.$invalid)">
        <div class="list" id="list" name="list">
          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">客户名称</span>
            <input type="text" name="cClientName" ng-model="clientInfo.cClientName" required>
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientName.$dirty && dataForm.cClientName.$invalid">客户名称必填</span>
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">电话</span>
            <input type="text" name="cClientTel" ng-model="clientInfo.cClientTel" ng-minlength="7" ng-maxlength="13" ng-pattern="/^[0-9](\d|-)*$/">
            <span class="icon warm-right weui-icon-warn"
               ng-show="dataForm.cClientTel.$dirty && dataForm.cClientTel.$invalid">请输入正确的电话号码</span>
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">传真</span>
            <input type="text" name="cClientFax" ng-model="clientInfo.cClientFax" ng-pattern="/^(\d{3,4}-)?\d{7,8}$/">
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientFax.$dirty && dataForm.cClientFax.$invalid">请输入正确的传真号码</span>
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">老板电话</span>
            <input type="text" name="cClientBossTel" ng-model="clientInfo.cClientBossTel" ng-maxlength="13" ng-pattern="/^[0-9](\d|-)*$/">
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientBossTel.$dirty && dataForm.cClientBossTel.$invalid">请输入正确的电话号码</span>
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">采购电话</span>
            <input type="text" name="cClientBuyerTel" ng-model="clientInfo.cClientBuyerTel" ng-maxlength="13" ng-pattern="/^[0-9](\d|-)*$/">
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientBuyerTel.$dirty && dataForm.cClientBuyerTel.$invalid">请输入正确的电话号码</span>
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">使用产品及品牌</span>
            <input type="text" ng-model="clientInfo.cClientUseBrands" ng-readonly="true" ng-click="showBrandsModel()">
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">每月用量</span>
            <input type="text" name="cClientDosage" ng-model="clientInfo.cClientDosage" ng-pattern="/^[1-9]\d*$/">
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientDosage.$dirty && dataForm.cClientDosage.$invalid">请输入正确的每月用量</span>
          </label>

          <label class="item item-input item-stacked-label item-icon-right">
            <span class="input-label">每次进货量</span>
            <input type="text" name="cClientBuy" ng-model="clientInfo.cClientBuy" ng-pattern="/^[1-9]\d*$/">
            <span class="icon warm-right weui-icon-warn"
                  ng-show="dataForm.cClientBuy.$dirty && dataForm.cClientBuy.$invalid">请输入正确的进货量</span>
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">是否含税</span>
            <input type="text" ng-model="clientInfo.cClientHasTax">
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">传款方式</span>
            <input type="text" ng-model="clientInfo.cClientPayWay">
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">客户信誉</span>
            <input type="text" ng-model="clientInfo.cClientCredit">
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">现时供应商</span>
            <input type="text" ng-model="clientInfo.cClientSupplier">
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">交谈拜访记录</span>
            <input type="text" ng-model="clientInfo.cClientRecord">
          </label>

          <label class="item item-input item-stacked-label">
            <span class="input-label">公司适用产品反馈</span>
            <input type="text" ng-model="clientInfo.cClientFeedback">
          </label>
        </div>
        <div class="padding">
          <button class="button button-block button-positive" type="submit">提交</button>
        </div>
      </form>
    </div>

    <script id="templates/selectbrands.html" type="text/ng-template">
      <ion-modal-view>
        <ion-header-bar class="bar bar-header bar-positive">
          <h1 class="title">使用产品及品牌</h1>
          <button class="button button-clear button-primary" ng-click="modal.hide()">关闭</button>
        </ion-header-bar>
        <ion-content class="padding">
          <div class="list">
            <ion-checkbox ng-repeat="item in devList"
                          ng-model="item.checked"
                          ng-checked="item.checked">
              {{ item.cCaption }}
            </ion-checkbox>
            <button class="button button-full button-positive" ng-click="comfirmselect(devList)">确定</button>
          </div>
        </ion-content>
      </ion-modal-view>
    </script>
  </ion-content>
</ion-view>
